/*
CCP 5.6
Write a program to swap odd and even bits in an integer with as few instructions as possible (e.g., bit 0 and bit 1 are swapped, bit 2 and bit 3 are swapped, and so on).
*/


#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <cmath>

int SwapBits(int x)
{
	return ((x & 0x55555555) << 1) | ((x & 0xAAAAAAAA) >> 1);
}

